import 'package:nyh_motorcade_app/entity/message_remind_entity.dart';

messageRemindEntityFromJson(MessageRemindEntity data, Map<String, dynamic> json) {
	if (json['page'] != null) {
		data.page = json['page'] is String
				? int.tryParse(json['page'])
				: json['page'].toInt();
	}
	if (json['pageSize'] != null) {
		data.pageSize = json['pageSize'] is String
				? int.tryParse(json['pageSize'])
				: json['pageSize'].toInt();
	}
	if (json['total'] != null) {
		data.total = json['total'] is String
				? int.tryParse(json['total'])
				: json['total'].toInt();
	}
	if (json['totalPage'] != null) {
		data.totalPage = json['totalPage'] is String
				? int.tryParse(json['totalPage'])
				: json['totalPage'].toInt();
	}
	if (json['item'] != null) {
		data.item = (json['item'] as List).map((v) => MessageRemindItem().fromJson(v)).toList();
	}
	return data;
}

Map<String, dynamic> messageRemindEntityToJson(MessageRemindEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['page'] = entity.page;
	data['pageSize'] = entity.pageSize;
	data['total'] = entity.total;
	data['totalPage'] = entity.totalPage;
	data['item'] =  entity.item?.map((v) => v.toJson())?.toList();
	return data;
}

messageRemindItemFromJson(MessageRemindItem data, Map<String, dynamic> json) {
	if (json['id'] != null) {
		data.id = json['id'].toString();
	}
	if (json['companyId'] != null) {
		data.companyId = json['companyId'].toString();
	}
	if (json['adminId'] != null) {
		data.adminId = json['adminId'].toString();
	}
	if (json['msgType'] != null) {
		data.msgType = json['msgType'].toString();
	}
	if (json['msgTypeName'] != null) {
		data.msgTypeName = json['msgTypeName'].toString();
	}
	if (json['msgContent'] != null) {
		data.msgContent = json['msgContent'].toString();
	}
	if (json['msgInfo'] != null) {
		data.msgInfo = json['msgInfo'].toString();
	}
	if (json['readStatus'] != null) {
		data.readStatus = json['readStatus'] is String
				? int.tryParse(json['readStatus'])
				: json['readStatus'].toInt();
	}
	if (json['createTime'] != null) {
		data.createTime = json['createTime'].toString();
	}
	if (json['timeFormat'] != null) {
		data.timeFormat = json['timeFormat'].toString();
	}
	return data;
}

Map<String, dynamic> messageRemindItemToJson(MessageRemindItem entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['id'] = entity.id;
	data['companyId'] = entity.companyId;
	data['adminId'] = entity.adminId;
	data['msgType'] = entity.msgType;
	data['msgTypeName'] = entity.msgTypeName;
	data['msgContent'] = entity.msgContent;
	data['msgInfo'] = entity.msgInfo;
	data['readStatus'] = entity.readStatus;
	data['createTime'] = entity.createTime;
	data['timeFormat'] = entity.timeFormat;
	return data;
}